<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('category_id')->nullable(); //所属栏目ID
            $table->foreign('category_id')->references('id')
                ->on('category')->onDelete('cascade');
            $table->string('title'); //标题
            $table->string('thumbnail')->nullable(); //缩略图
            $table->text('album')->nullable(); //图集，"|"号分隔
            $table->text('album_s')->nullable(); //图集（原图0.5倍），"|"分隔
            $table->text('download_name')->nullable(); //提供下载的文件名，"|"号分隔
            $table->text('download_file')->nullable(); //提供下载的文件，"|"号分隔
            $table->longText('content')->nullable(); //内容
            $table->string('route')->default('articleContent'); //路由
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('article');
    }
}
